$ sudo apt install docker-ce docker-ce-cli containerd.io -y
To verify that you have Docker Compose running correctly, use the following:
$ docker compose --help
Next, make sure the Docker process will automatically start upon system
reboot by running this command:
$ sudo systemctl enable docker –-now
Docker requires the use of sudo, which can get a little inconvenient. If you
want to avoid having to enter sudo before executing Docker-related commands,
add the kali user to the docker Linux group:
$ sudo usermod -aG docker $USER
Once you’ve done this, you shouldn’t need sudo to run Docker commands.
Cloning the Book’s Repository
You can find the lab’s files in the open source Black Hat Bash repository at
https://github.com/dolevf/Black-Hat-Bash. This repository contains the Docker
configurations needed to build the lab, as well as all of the bash scripts mentioned
in the future chapters of this book.
Kali comes preloaded with git, which you can use to clone and download the
Black Hat Bash repository. To do so, run the following:
$ git clone https://github.com/dolevf/Black-Hat-Bash.git
Next, move into the repository’s root directory and take a quick look at its
contents:
$ cd Black-Hat-Bash && ls -l
--snip--
drwxr-xr-x 2 kali kali 4096 Jul 22 23:07 ch01
drwxr-xr-x 2 kali kali 4096 Jul 22 23:07 ch02
drwxr-xr-x 2 kali kali 4096 Jul 22 23:07 ch03
drwxr-xr-x 2 kali kali 4096 Jul 22 23:07 ch04
drwxr-xr-x 2 kali kali 4096 Jul 22 23:07 ch05
--snip--
As you can see in the output, the repository’s contents are organized into
directories for each of the book’s chapters. The repository also includes a lab
directory, which is what we’ll use to set up the lab in the next section.
Deploying Docker Containers
The contents of the lab directory in the Black Hat Bash repository control all
networking infrastructure, machines, and applications used within the lab. This
directory includes a run.sh script file. By running this script without any
arguments, you can see that it is used to deploy, tear down, rebuild, clean, and
check the status of our environment:
Black Hat Bash (Early Access) © 2023 by Dolev Farhi and Nick Aleks